Skip to content

Add message support to the new search tab#5829

Merged
stefanceriu merged 7 commits into
developfrom
stefan/globalSearch
Jul 3, 2026
Merged

Add message support to the new search tab#5829
stefanceriu merged 7 commits into
developfrom
stefan/globalSearch

Conversation

@stefanceriu

Copy link
Copy Markdown
Member

Adds a Messages tab to global search, next to Rooms.

It's backed by a new SearchServiceProxy wrapping the SDK's SearchService, exposed on the ClientProxy and using the session's search index store.

Message results show the room's name and avatar with a sender-prefixed preview. Image/video/audio/file matches get a thumbnail (or type icon) with filename and size.

Polls, stickers, redactions and live locations are supported too but depend on matrix-org/matrix-rust-sdk#6710

Wrap the SDK's SearchService in a SearchServiceProxy that publishes typed
message results and paginates on demand, expose it on the ClientProxy, and
enable the search index store on the session. Also opens up the timeline item
factory's message content builder so the proxy can reuse it.
Split global search into Rooms and Messages tabs. The Messages tab lists
matching events with the room's name and avatar, a sender-prefixed preview,
rich media (image/video/audio/file) previews, and a loading indicator, then
paginates as you scroll. Queries are debounced and the previous one is
superseded so late results can't clobber a newer search.
The SDK now surfaces polls, stickers, redactions and live location shares
alongside plain messages. Map them to their preview content instead of
dropping them as unsupported events.
@stefanceriu stefanceriu requested a review from a team as a code owner July 2, 2026 12:47
@stefanceriu stefanceriu added the pr-wip for anything that isn't ready to ship and will be enabled at a later date label Jul 2, 2026
@stefanceriu stefanceriu requested review from pixlwave and removed request for a team July 2, 2026 12:47

@pixlwave pixlwave left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, nothing major just small thoughts 🔍

Comment thread ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift Outdated
Comment thread ElementX/Sources/Other/Avatars.swift Outdated
Comment thread ElementX/Sources/Screens/SearchScreen/View/SearchScreen.swift
Comment on lines +201 to +208
guard let selectedID else { return }
switch context.viewState.bindings.searchMode {
case .rooms:
context.send(viewAction: .selectRoom(roomID: selectedID))
case .messages:
guard let message = context.viewState.messages.first(where: { $0.id == selectedID }) else { return }
context.send(viewAction: .selectMessage(roomID: message.roomID, eventID: message.id))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important for right now, part of me feels like there should be a single selectItem view action and then this logic could be in the view model and tested.

Comment thread ElementX/Sources/Screens/SearchScreen/View/SearchScreen.swift Outdated
Comment thread ElementX/Sources/Screens/SearchScreen/SearchScreenViewModel.swift
Comment thread ElementX/Sources/Services/Search/SearchServiceProxy.swift Outdated
Comment thread ElementX/Sources/Services/Search/SearchServiceProxy.swift
Comment thread ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift Outdated
Comment thread ElementX/Sources/Screens/SearchScreen/SearchScreenViewModel.swift
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.42060% with 259 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.91%. Comparing base (1236615) to head (4cafd16).
⚠️ Report is 12 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...urces/Screens/SearchScreen/View/SearchScreen.swift 52.71% 122 Missing ⚠️
...meline/TimelineItems/RoomTimelineItemFactory.swift 0.00% 63 Missing ⚠️
...rces/Screens/SearchScreen/SearchScreenModels.swift 24.63% 52 Missing ⚠️
.../FlowCoordinators/UserSessionFlowCoordinator.swift 21.42% 11 Missing ⚠️
ElementX/Sources/Other/SDKListener.swift 0.00% 4 Missing ⚠️
...Screens/SearchScreen/SearchScreenCoordinator.swift 0.00% 3 Missing ⚠️
...s/Screens/SearchScreen/SearchScreenViewModel.swift 96.00% 2 Missing ⚠️
...ources/Services/UserSession/UserSessionStore.swift 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5829      +/-   ##
===========================================
- Coverage    74.21%   73.91%   -0.31%     
===========================================
  Files          815      817       +2     
  Lines        56635    57554     +919     
===========================================
+ Hits         42030    42539     +509     
- Misses       14605    15015     +410     
Flag Coverage Δ
unittests 64.23% <44.42%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

- Drop the redundant searchService coordinator/view model parameter; derive it from the client proxy.
- Rename the globalSearch avatar size to search.
- Lift the query observation streams out of their tasks.
- Restore the appeared and updateVisibleRange comments.
- Use CompoundIcon defaults and a scaledFrame for media previews.
- Simplify the result mapping with compactMap(makeResult) and drop unsupported events by returning nil.
- Move the preview helpers beneath the previews.
Move the protocol methods to the top under a Public mark and gather the
helpers beneath a Private mark.
@stefanceriu stefanceriu merged commit dd6f8bc into develop Jul 3, 2026
14 of 16 checks passed
@stefanceriu stefanceriu deleted the stefan/globalSearch branch July 3, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-wip for anything that isn't ready to ship and will be enabled at a later date

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants